import type { ProfileDetail, ProfileParams, BaseProfile } from '@/types/member'
import { http, http_object, http_last_data } from '@/utils/http'

/**
 * 获取个人信息
 */
export const getMemberProfileAPI = () => {
  return http_object<BaseProfile>({
    method: 'GET',
    url: '/UserModelViewSet/myself_info',
  })
}

/**
 * 修改个人信息
 * @param data 请求体参数
 */
export const putMemberProfileAPI = (data: BaseProfile) => {
  return http_object<BaseProfile>({
    method: 'PUT',
    url: '/UserModelViewSet/modify_nickname',
    data,
  })
}

/**
 * 修改昵称
 * @param nickname 请求体参数
 */
export const putNicknameAPI = (data: object) => {
  return http_object<BaseProfile>({
    method: 'PUT',
    url: '/UserModelViewSet/modify_nickname',
    data,
  })
}
/**
 * 修改密码
 * @param password 请求体参数
 */
export const putPasswordAPI = (data: object) => {
  return http_last_data<object>({
    method: 'PUT',
    url: '/UserModelViewSet/change_password',
    data,
  })
}
